<?php
include 'includes.php';


$boss = R::load('bosses', $_GET['id']);
?>


<!-- Bootstrap core CSS -->

<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="shortcut icon" href="../../assets/ico/favicon.ico">
        <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="bootstrap/css/css.css" rel="stylesheet">
        <script type="text/javascript" src="bootstrap/js/jquery-1.11.0.min.js"></script>

        <title>The Pengüins mafia Bis List - Editar PJ</title>

    </head>


<?php
include './cabecera.php';


?>




<!-- Main jumbotron for a primary marketing message or call to action -->

<script type="text/javascript" src="http://static.wowhead.com/widgets/power.js"></script><script>var wowhead_tooltips = {"colorlinks": true, "iconizelinks": true, "renamelinks": true}</script>
<div class="container contenido">

    <div class="page-header">
        <h2><?php echo $boss->nombre ?> <small>Items</small> </h2>
    </div>
</div>

<?php
if (isset($_SESSION['user']) && $_SESSION['user']['permisos'] == 'admin') {
    ?>

    <div class="container">
        <!-- Example row of columns -->
        <div class="row">
            <div class="col-md-1">
                <button type="button" class="btn btn-success btn-md" onclick="window.location.href = 'additem.php?id=<?php echo $boss->id; ?> '">
                    <span class="glyphicon glyphicon-plus"></span> Añadir
                </button>
            </div>
        </div>
        <br />

        <?php
        $rows = R::getAll('select * from items where bosses_id = :id', [':id' => $boss->id]);

        $items = R::convertToBeans('items', $rows);
        foreach ($items as $i) {

            echo "

            <div class = 'row'>
            
    <div class = 'col-md-6 vcenter'>
    <a href='http://www.wowhead.com/item=".$i->linkh."' rel='item=".$i->linkh."'>a</a>           
    </div>
    <div class = 'col-md-1 vcenter'>

    <button type = 'button' class = 'btn btn-danger btn-md' onclick=\"window.location.href='borraritem.php?id=" . $i->id . "&idboss=".$boss->id."'\">
    <span class = 'glyphicon glyphicon-trash'></span> Eliminar
    </button>

    </div>

    </div>
    ";
        }
        ?>



        <hr>

    </div> <!-- /container -->
    <?php
}
?>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->


<?php
include 'pie.php';
?>